Imports AxSftTreeLib70
Imports SftTreeLib70
Imports Softelvdm.OLEConvert

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim path As String = System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(Application.ExecutablePath)))
    ' Flash
    AxShockwaveFlash1.Movie = path + "\\header.swf"
    AxSftTree1.get_Item(3).Cell(1).AttachContentWindow(AxShockwaveFlash1.Handle, SftTreeContentWindowStyleConstants.contentWindowSftTreeKeepSize)
    AxSftTree1.get_Item(3).Cell(1).Text = ""

    ' Windows Media Player
    AxWindowsMediaPlayer1.URL = path + "\\intermission.wmv"
    AxSftTree1.get_Item(4).Cell(1).AttachContentWindow(AxWindowsMediaPlayer1.Handle, SftTreeContentWindowStyleConstants.contentWindowSftTreeKeepSize)
    AxSftTree1.get_Item(4).Cell(1).Text = ""

    ' Web Browser
    webBrowser1.Navigate("http://www.softelvdm.com")
    Dim Item As SftTreeItem = AxSftTree1.get_Item(5)
    Dim Cell As SftTreeCell = Item.Cell(1)
    Cell.AttachContentWindow(webBrowserPanel.Handle, SftTreeContentWindowStyleConstants.contentWindowSftTreeNone)
    Cell.Text = ""
    Item.MinHeightPix = 300 ' always exactly 300 pixels
    Item.MaxHeightPix = 300 ' always exactly 300 pixels

    ' Form
    Dim f As Form2 = New Form2()
    AxSftTree1.get_Item(6).Cell(1).AttachContentWindow(f.Handle, SftTreeContentWindowStyleConstants.contentWindowSftTreeKeepSize)
    AxSftTree1.get_Item(6).Cell(1).Text = ""

    AxSftTree1.RowHeaders.MakeOptimal() ' Make row header width optimal, so text and pictures are not clipped horizontally.
    AxSftTree1.ColumnsObj.MakeOptimal() ' Make all columns optimal

    ' triple the size of the last column
    AxSftTree1.get_Column(1).WidthPix = AxSftTree1.get_Column(1).WidthPix * 3

    AxSftTree1.Items.RecalcHorizontalExtent() ' Update horizontal scrollbar

    AxSftTree1.Items.Current = 0 ' select the first item
    AxSftTree1.get_Item(0).Selected = True

    AxSftTree1.Dock = DockStyle.Fill ' Maximize the main window

    Me.WindowState = FormWindowState.Maximized
End Sub

Private Sub AxSftTree1_ItemExpanded(ByVal sender As System.Object, ByVal e As AxSftTreeLib70._DSftTreeEvents_ItemExpandedEvent) Handles AxSftTree1.ItemExpanded
    If e.itemIndex = 2 Then
        AxWindowsMediaPlayer1.Ctlcontrols.play()
    End If
End Sub

Private Sub AxSftTree1_ItemCollapsed(ByVal sender As System.Object, ByVal e As AxSftTreeLib70._DSftTreeEvents_ItemCollapsedEvent) Handles AxSftTree1.ItemCollapsed
    If e.itemIndex = 2 Then
        AxWindowsMediaPlayer1.Ctlcontrols.pause()
    End If
End Sub

Private Sub AxSftTree1_ItemDblClick(ByVal sender As System.Object, ByVal e As AxSftTreeLib70._DSftTreeEvents_ItemDblClickEvent) Handles AxSftTree1.ItemDblClick
    If e.areaType = SftTreeAreaTypeConstants.constSftTreeColumnRes Then
        AxSftTree1.get_Column(e.colIndex).MakeOptimal()
    End If
End Sub
End Class